package com.fzx.fzwsupplysystem.view;

import android.content.Context;
import android.support.v7.widget.AppCompatTextView;
import android.util.AttributeSet;

import com.fzx.fzwsupplysystem.util.CountTimes;

/**
 * 项目：AndroidUtilsDemo
 * 创建人：FangZhiXin
 * 时间：2019/11/18 15:01
 * 描述：
 */
public class CountTimeTextView extends AppCompatTextView {

    public CountTimes countTimes;

    public CountTimeTextView(Context context) {
        super(context);
        init();
    }

    public CountTimeTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public CountTimeTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {
        countTimes = new CountTimes();
    }

    public void startTimeDown(int start, int interval, CountTimes.OnCountTimeListener listener) {
        countTimes.startTimeDown(start, interval, listener);
    }

    public void startTimeCount(int start, int end, int interval, CountTimes.OnCountTimeListener listener) {
        countTimes.startTimeCount(start, end, interval, listener);
    }

    public void restart() {
        countTimes.restart();
    }

    public void cancel() {
        countTimes.cancel();
    }

    public void release() {
        countTimes.release();
    }

    public boolean isCancel() {
        return countTimes.isCancel();
    }

    public void resetTime() {
        countTimes.resetTime();
    }

}
